package com.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.sms.Sms_Sku_Full_Reduction;
import com.shop.service.Sms_Sku_Full_Reduction_Service;
import com.shop.to.SkuByReductionTo;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/skufull/reduction")
public class Sms_Sku_Full_Reduction_Controller {

    @Autowired
    private Sms_Sku_Full_Reduction_Service sms_sku_full_reduction_service;

    @PostMapping("/addReductionBySKU")
    public R addReduction(@RequestBody SkuByReductionTo skuByReductionTo){
    sms_sku_full_reduction_service.saveReductionBySku(skuByReductionTo);
    return R.ok();
    }

    /**
     * 显示所有满减
     * @param page
     * @param limit
     * @param sms_sku_full_reduction
     * @return
     */
    @GetMapping("/find_All_Sku_Full_Reduction")
    public LayuiUtils<Sms_Sku_Full_Reduction> find_All_Sku_Full_Reduction(Integer page, Integer limit,Sms_Sku_Full_Reduction sms_sku_full_reduction){
        Page<Sms_Sku_Full_Reduction> pages = new Page<>(page,limit);
        return sms_sku_full_reduction_service.find_sku_full_reduction(pages,sms_sku_full_reduction);
    }

    /**
     * 新增
     * @param sms_sku_full_reduction
     * @return
     */
//    @PostMapping("/insert_Sku_Full_Reduction")
//    public R insert_Sku_Full_Reduction(Sms_Sku_Full_Reduction sms_sku_full_reduction){
//        return sms_sku_full_reduction_service.insert_sku_full_reduction(sms_sku_full_reduction);
//    }

    /**
     * 删除
     * @param id
     * @return
     */
//    @DeleteMapping("/delete_insert_Sku_Full_Reduction")
//    public R delete_Sku_Full_Reduction(@RequestParam List<Long> id){
//        return sms_sku_full_reduction_service.delete_sku_full_reduction(id);
//    }

    /**
     * 修改
     * @param sms_sku_full_reduction
     * @return
     */
//    @PutMapping("/update_Sku_Full_Reduction")
//    public R update_Sku_Full_Reduction(Sms_Sku_Full_Reduction sms_sku_full_reduction){
//        return sms_sku_full_reduction_service.update_sku_full_reduction(sms_sku_full_reduction);
//    }
}